/*    */ package com.zimbra.cs.ldap.unboundid;
/*    */ 
/*    */ import com.unboundid.util.ssl.SSLUtil;
/*    */ import com.zimbra.common.net.SocketFactories;
/*    */ import com.zimbra.common.net.TrustManagers;
/*    */ import com.zimbra.cs.ldap.LdapException;
/*    */ import java.security.GeneralSecurityException;
/*    */ import javax.net.ssl.SSLContext;
/*    */ import javax.net.ssl.SSLSocketFactory;
/*    */ import javax.net.ssl.TrustManager;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class LdapSSLUtil
/*    */ {
/*    */   static SSLSocketFactory createSSLSocketFactory(boolean allowUntrustedCerts)
/*    */   {
/* 73 */     if (allowUntrustedCerts) {
/* 74 */       return SocketFactories.dummySSLSocketFactory();
/*    */     }
/* 76 */     return SocketFactories.defaultSSLSocketFactory();
/*    */   }
/*    */   
/*    */   private static TrustManager getTrustManager(boolean allowUntrustedCerts)
/*    */   {
/* 81 */     if (allowUntrustedCerts) {
/* 82 */       return TrustManagers.dummyTrustManager();
/*    */     }
/* 84 */     return TrustManagers.customTrustManager();
/*    */   }
/*    */   
/*    */   static SSLContext createSSLContext(boolean allowUntrustedCerts) throws LdapException
/*    */   {
/* 89 */     TrustManager tm = getTrustManager(allowUntrustedCerts);
/* 90 */     SSLUtil sslUtil = new SSLUtil(tm);
/*    */     try
/*    */     {
/* 93 */       return sslUtil.createSSLContext();
/*    */     } catch (GeneralSecurityException e) {
/* 95 */       throw UBIDLdapException.mapToLdapException(e);
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/ldap/unboundid/LdapSSLUtil.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */